﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Screen.aspx.cs" Inherits="WEB.APP.Modules.System.Screen" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script language="javascript" type="text/javascript">
        function DocumentReady() {
            MethodNamespace.DocumentReady({
                success: function() {

                }
            });
        }

        function AlterEdit(el) {
            MethodNamespace.QuickEdit(el.record.data.ScreenId, el.record.data.ScreenName);
            stMain.commitChanges();
        }

        var startEditing = function(e) {
            if (e.getKey() === e.ENTER || e.getKey() === e.SPACE) {
                StartEdit();
            }
        };

        function StartEdit() {
            var record = grMain.getSelectionModel().getSelected(),
                    index = grMain.store.indexOf(record);
            var clIndex = grMain.colModel.getIndexById('ScreenName');
            StartEdit_Grid(grMain, index, clIndex);
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ext:Store ID="stMain" runat="server" OnRefreshData="MainList_OnRefreshData" AutoLoad="True"
        RemotePaging="true" GroupField="ModuleName">
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="ScreenId">
                <Fields>
                    <ext:RecordField Name="ScreenId" />
                    <ext:RecordField Name="ScreenName" />
                    <ext:RecordField Name="Icon" />
                    <ext:RecordField Name="Parent" />
                    <ext:RecordField Name="ModuleName" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Viewport ID="ViewPort1" runat="server" Layout="BorderLayout">
        <Items>
            <ext:GridPanel ID="grMain" runat="server" StoreID="stMain" AutoExpandColumn="ScreenName"
                BodyBorder="false" Border="false" Region="Center" RowHeight="1" StripeRows="true"
                TrackMouseOver="true" ColumnLines="true">
                <TopBar>
                    <ext:Toolbar ID="Toolbar1" runat="server">
                        <Items>
                            <ext:Button ID="btnView" Text="Reload" Icon="Magnifier" runat="server" />
                            <ext:ToolbarSeparator />
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:RowNumbererColumn />
                        <ext:Column ColumnID="ScreenName" DataIndex="ScreenName" Header="Screen" Width="200">
                            <Editor>
                                <ext:TextField runat="server" SelectOnFocus="true"/>
                            </Editor>
                        </ext:Column>
                        <ext:Column ColumnID="Icon" DataIndex="Icon" Header="Icon" />
                        <ext:Column ColumnID="Parent" DataIndex="Parent" Header="Parent" />
                        <ext:Column ColumnID="ModuleName" DataIndex="ModuleName" Header="Module" />
                    </Columns>
                </ColumnModel>
                <View>
                    <ext:GroupingView ID="GroupingView1" HideGroupedColumn="true" runat="server" EnableRowBody="true"
                        MarkDirty="false">
                    </ext:GroupingView>
                </View>
                <KeyMap>
                    <ext:KeyBinding>
                        <Keys>
                            <ext:Key Code="ESC" />
                        </Keys>
                        <Listeners>
                            <Event Handler="KeyPress_ESC(grdMain)" />
                        </Listeners>
                    </ext:KeyBinding>
                </KeyMap>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
                </SelectionModel>
                <LoadMask ShowMask="true" />
                <Listeners>
                    <RowDblClick Handler="StartEdit();" />
                    <KeyDown Fn="startEditing" />
                    <AfterEdit Fn="AlterEdit" />
                </Listeners>
            </ext:GridPanel>
        </Items>
    </ext:Viewport>
    </form>
</body>
</html>
